tests/gpg: fix the check of GPG support
authorDenis Pynkin <denis.pynkin@collabora.com>
Mon, 29 Jul 2019 23:16:57 +0000 (02:16 +0300)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 1 Aug 2019 02:06:47 +0000 (02:06 +0000)
Shell function `has_gpgme` shouldn't exit if GPG support is not detected
since it stop any test with error.

Added function `skip_without_gpgme` to skip the whole test if it is
useless without GPG support

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Closes: #1889
Approved by: cgwalters

tests/libtest.sh

index 632ccee8ceb67edc424f73988b1f46d4d9f86003..8832e63ccc239bb29e3f3bf9928372e5b8671c4b 100755 (executable)
@@ -605,10 +605,18 @@ skip_without_experimental () {
 }
 
 has_gpgme () {
+    local ret
     ${CMD_PREFIX} ostree --version > version.txt
-    assert_file_has_content version.txt '- gpgme'
+    grep -q -e '- gpgme' version.txt
+    ret=$?
     rm -f version.txt
-    true
+    return ${ret}
+}
+
+skip_without_gpgme() {
+    if ! has_gpgme; then
+        skip "no gpg support compiled in"
+    fi
 }
 
 # Find an appropriate gpg program to use. We want one that has the